Merge changes I4ac3bc14,I470acb8b
authorDemon <chadh@wikimedia.org>
Sun, 11 Nov 2012 19:16:38 +0000 (19:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 11 Nov 2012 19:16:38 +0000 (19:16 +0000)
* changes:
  make addPortletLink work with CologneBlue
  (bug 18338) WAI-ARIA landmark roles in most used skins

resources/mediawiki/mediawiki.util.js
skins/CologneBlue.php
skins/Modern.php
skins/MonoBook.php
skins/Vector.php

index 4bb004a..05ffcc0 100644 (file)
                        // just add it to the bottom of their 'sidebar' element as a fallback
                        switch ( mw.config.get( 'skin' ) ) {
                        case 'standard':
-                       case 'cologneblue':
                                $( '#quickbar' ).append( $link.after( '<br/>' ) );
                                return $link[0];
                        case 'nostalgia':
index 84042c3..b81b1aa 100644 (file)
@@ -279,17 +279,17 @@ class CologneBlueTemplate extends BaseTemplate {
 ?>
 <div id="content">
        <div id="topbar">
-               <p id="sitetitle">
+               <p id="sitetitle" role="banner">
                        <a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>">
                                <?php echo wfMessage( 'sitetitle' )->escaped() ?>
                        </a>
                </p>
                <p id="sitesub"><?php echo wfMessage( 'sitesubtitle' )->escaped() ?></p>
-               <div id="toplinks">
+               <div id="toplinks" role="navigation">
                        <p id="syslinks"><?php echo $this->sysLinks() ?></p>
                        <p id="variantlinks"><?php echo $this->variantLinks() ?></p>
                </div>
-               <div id="linkcollection">
+               <div id="linkcollection" role="navigation">
                        <div id="langlinks"><?php echo str_replace( '<br />', '', $this->otherLanguages() ) ?></div>
                        <?php echo $this->getSkin()->getCategories() ?>
                        <div id="titlelinks"><?php echo $this->pageTitleLinks() ?></div>
@@ -298,7 +298,7 @@ class CologneBlueTemplate extends BaseTemplate {
                        <?php } ?>
                </div>
        </div>
-       <div id="article">
+       <div id="article" role="main">
                <?php if ( $this->getSkin()->getSiteNotice() ) { ?>
                <div id="siteNotice"><?php echo $this->getSkin()->getSiteNotice() ?></div>
                <?php } ?>
@@ -328,7 +328,7 @@ class CologneBlueTemplate extends BaseTemplate {
                ob_start();
 ?>
        </div>
-       <div id='footer'>
+       <div id="footer" role="contentinfo">
 <?php
                // Page-related links
                echo $this->bottomLinks();
@@ -430,9 +430,10 @@ class CologneBlueTemplate extends BaseTemplate {
                        $qbmyoptions[$key] = null;
                }
 
-               $bar['qbedit'] = $qbedit;
-               $bar['qbpageoptions'] = $qbpageoptions;
-               $bar['qbmyoptions'] = $qbmyoptions;
+               // Use the closest reasonable name
+               $bar['cactions'] = $qbedit;
+               $bar['pageoptions'] = $qbpageoptions; // this is a non-standard portlet name, but nothing fits
+               $bar['personal'] = $qbmyoptions;
 
                return $bar;
        }
@@ -479,12 +480,9 @@ class CologneBlueTemplate extends BaseTemplate {
                $bar = array();
                foreach ( $orig_bar as $heading => $data ) {
                        if ( $heading == 'SEARCH' ) {
-                               $bar['qbfind'] = $this->searchForm( 'sidebar' );
+                               $bar['search'] = $this->searchForm( 'sidebar' );
                        } elseif ( $heading == 'TOOLBOX' ) {
-                               $bar['toolbox'] = $this->getToolbox();
-                       } elseif ( $heading == 'navigation' ) {
-                               // Use the navigation heading from standard sidebar as the "browse" section
-                               $bar['qbbrowse'] = $data;
+                               $bar['tb'] = $this->getToolbox();
                        } else {
                                $bar[$heading] = $data;
                        }
@@ -492,12 +490,22 @@ class CologneBlueTemplate extends BaseTemplate {
 
 
                // Output the sidebar
+               // CologneBlue uses custom messages for some portlets, but we should keep the ids for consistency
+               $idToMessage = array(
+                       'search' => 'qbfind',
+                       'navigation' => 'qbbrowse',
+                       'tb' => 'toolbox',
+                       'cactions' => 'qbedit',
+                       'personal' => 'qbmyoptions',
+                       'pageoptions' => 'qbpageoptions',
+               );
+
                $s = "<div id='quickbar'>\n";
 
                foreach ( $bar as $heading => $data ) {
-                       $headingMsg = wfMessage( $heading );
-                       $headingHTML = "<h6>" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "</h6>";
                        $portletId = Sanitizer::escapeId( "p-$heading" );
+                       $headingMsg = wfMessage( $idToMessage[$heading] ? $idToMessage[$heading] : $heading );
+                       $headingHTML = "<h6>" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "</h6>";
                        $listHTML = "";
 
                        if ( is_array( $data ) ) {
@@ -517,7 +525,8 @@ class CologneBlueTemplate extends BaseTemplate {
                        }
 
                        if ( $listHTML ) {
-                               $s .= "<div class=\"portlet\" id=\"$portletId\">\n$headingHTML\n$listHTML\n</div>\n";
+                               $role = ( $heading == 'search' ) ? 'search' : 'navigation';
+                               $s .= "<div class=\"portlet\" id=\"$portletId\" role=\"$role\">\n$headingHTML\n$listHTML\n</div>\n";
                        }
                }
 
index 4211bb8..1987c1c 100644 (file)
@@ -73,7 +73,7 @@ class ModernTemplate extends MonoBookTemplate {
 <?php $this->cactions(); ?>
 
        <!-- content -->
-       <div id="mw_content">
+       <div id="mw_content" role="main">
        <!-- contentholder does nothing by default, but it allows users to style the text inside
             the content area without affecting the meaning of 'em' in #mw_content, which is used
             for the margins -->
@@ -115,7 +115,7 @@ class ModernTemplate extends MonoBookTemplate {
        <div class="mw_clear"></div>
 
        <!-- personal portlet -->
-       <div class="portlet" id="p-personal">
+       <div class="portlet" id="p-personal" role="navigation">
                <h5><?php $this->msg('personaltools') ?></h5>
                <div class="pBody">
                        <ul>
@@ -129,7 +129,7 @@ class ModernTemplate extends MonoBookTemplate {
 
 
        <!-- footer -->
-       <div id="footer"<?php $this->html('userlangattributes') ?>>
+       <div id="footer" role="contentinfo"<?php $this->html('userlangattributes') ?>>
                        <ul id="f-list">
 <?php
                foreach( $this->getFooterLinks("flat") as $aLink ) {
index 0bd7134..6f74273 100644 (file)
@@ -80,7 +80,7 @@ class MonoBookTemplate extends BaseTemplate {
 
                $this->html( 'headelement' );
 ?><div id="globalWrapper">
-<div id="column-content"><div id="content" class="mw-body-primary">
+<div id="column-content"><div id="content" class="mw-body-primary" role="main">
        <a id="top"></a>
        <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
 
@@ -105,7 +105,7 @@ class MonoBookTemplate extends BaseTemplate {
 </div></div>
 <div id="column-one"<?php $this->html('userlangattributes')  ?>>
 <?php $this->cactions(); ?>
-       <div class="portlet" id="p-personal">
+       <div class="portlet" id="p-personal" role="navigation">
                <h5><?php $this->msg('personaltools') ?></h5>
                <div class="pBody">
                        <ul<?php $this->html('userlangattributes') ?>>
@@ -116,7 +116,7 @@ class MonoBookTemplate extends BaseTemplate {
                        </ul>
                </div>
        </div>
-       <div class="portlet" id="p-logo">
+       <div class="portlet" id="p-logo" role="banner">
 <?php
                        echo Html::element( 'a', array(
                                'href' => $this->data['nav_urls']['mainpage']['href'],
@@ -134,7 +134,7 @@ class MonoBookTemplate extends BaseTemplate {
        $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
 
        if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { ?>
-<div id="footer"<?php $this->html('userlangattributes') ?>>
+<div id="footer" role="contentinfo"<?php $this->html('userlangattributes') ?>>
 <?php
                $footerEnd = '</div>';
        } else {
@@ -200,7 +200,7 @@ echo $footerEnd;
        function searchBox() {
                global $wgUseTwoButtonsSearchForm;
 ?>
-       <div id="p-search" class="portlet">
+       <div id="p-search" class="portlet" role="search">
                <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
                <div id="searchBody" class="pBody">
                        <form action="<?php $this->text('wgScript') ?>" id="searchform">
@@ -227,7 +227,7 @@ echo $footerEnd;
         */
        function cactions() {
 ?>
-       <div id="p-cactions" class="portlet">
+       <div id="p-cactions" class="portlet" role="navigation">
                <h5><?php $this->msg('views') ?></h5>
                <div class="pBody">
                        <ul><?php
@@ -244,7 +244,7 @@ echo $footerEnd;
        /*************************************************************************************************/
        function toolbox() {
 ?>
-       <div class="portlet" id="p-tb">
+       <div class="portlet" id="p-tb" role="navigation">
                <h5><?php $this->msg('toolbox') ?></h5>
                <div class="pBody">
                        <ul>
@@ -267,7 +267,7 @@ echo $footerEnd;
        function languageBox() {
                if( $this->data['language_urls'] ) {
 ?>
-       <div id="p-lang" class="portlet">
+       <div id="p-lang" class="portlet" role="navigation">
                <h5<?php $this->html('userlangattributes') ?>><?php $this->msg('otherlanguages') ?></h5>
                <div class="pBody">
                        <ul>
@@ -288,7 +288,7 @@ echo $footerEnd;
         * @param $cont array|string
         */
        function customBox( $bar, $cont ) {
-               $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ) );
+               $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ), 'role' => 'navigation' );
                $tooltip = Linker::titleAttrib( "p-$bar" );
                if ( $tooltip !== false ) {
                        $portletAttribs['title'] = $tooltip;
index 227d18d..104cdde 100644 (file)
@@ -156,7 +156,7 @@ class VectorTemplate extends BaseTemplate {
                <div id="mw-page-base" class="noprint"></div>
                <div id="mw-head-base" class="noprint"></div>
                <!-- content -->
-               <div id="content" class="mw-body">
+               <div id="content" class="mw-body" role="main">
                        <a id="top"></a>
                        <div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
                        <?php if ( $this->data['sitenotice'] ): ?>
@@ -238,13 +238,13 @@ class VectorTemplate extends BaseTemplate {
                <!-- panel -->
                        <div id="mw-panel" class="noprint">
                                <!-- logo -->
-                                       <div id="p-logo"><a style="background-image: url(<?php $this->text( 'logopath' ) ?>);" href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ) ?>></a></div>
+                                       <div id="p-logo" role="banner"><a style="background-image: url(<?php $this->text( 'logopath' ) ?>);" href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ) ?>></a></div>
                                <!-- /logo -->
                                <?php $this->renderPortals( $this->data['sidebar'] ); ?>
                        </div>
                <!-- /panel -->
                <!-- footer -->
-               <div id="footer"<?php $this->html( 'userlangattributes' ) ?>>
+               <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
                        <?php foreach( $this->getFooterLinks() as $category => $links ): ?>
                                <ul id="footer-<?php echo $category ?>">
                                        <?php foreach( $links as $link ): ?>
@@ -327,7 +327,7 @@ class VectorTemplate extends BaseTemplate {
                        $msg = $name;
                }
                ?>
-<div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo Linker::tooltip( 'p-' . $name ) ?>>
+<div class="portal" role="navigation" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo Linker::tooltip( 'p-' . $name ) ?>>
        <h5<?php $this->html( 'userlangattributes' ) ?>><?php $msgObj = wfMessage( $msg ); echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $msg ); ?></h5>
        <div class="body">
 <?php
@@ -377,7 +377,7 @@ class VectorTemplate extends BaseTemplate {
                        switch ( $element ) {
                                case 'NAMESPACES':
 ?>
-<div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+<div id="p-namespaces" role="navigation" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg( 'namespaces' ) ?></h5>
        <ul<?php $this->html( 'userlangattributes' ) ?>>
                <?php foreach ( $this->data['namespace_urls'] as $link ): ?>
@@ -389,7 +389,7 @@ class VectorTemplate extends BaseTemplate {
                                break;
                                case 'VARIANTS':
 ?>
-<div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+<div id="p-variants" role="navigation" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h4>
        <?php foreach ( $this->data['variant_urls'] as $link ): ?>
                <?php if ( stripos( $link['attributes'], 'selected' ) !== false ): ?>
@@ -410,7 +410,7 @@ class VectorTemplate extends BaseTemplate {
                                break;
                                case 'VIEWS':
 ?>
-<div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) { echo ' emptyPortlet'; } ?>">
+<div id="p-views" role="navigation" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) { echo ' emptyPortlet'; } ?>">
        <h5><?php $this->msg('views') ?></h5>
        <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach ( $this->data['view_urls'] as $link ): ?>
@@ -427,7 +427,7 @@ class VectorTemplate extends BaseTemplate {
                                break;
                                case 'ACTIONS':
 ?>
-<div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+<div id="p-cactions" role="navigation" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><span><?php $this->msg( 'actions' ) ?></span><a href="#"></a></h5>
        <div class="menu">
                <ul<?php $this->html( 'userlangattributes' ) ?>>
@@ -441,7 +441,7 @@ class VectorTemplate extends BaseTemplate {
                                break;
                                case 'PERSONAL':
 ?>
-<div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+<div id="p-personal" role="navigation" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg( 'personaltools' ) ?></h5>
        <ul<?php $this->html( 'userlangattributes' ) ?>>
 <?php
@@ -470,7 +470,7 @@ class VectorTemplate extends BaseTemplate {
                                break;
                                case 'SEARCH':
 ?>
-<div id="p-search">
+<div id="p-search" role="search">
        <h5<?php $this->html( 'userlangattributes' ) ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
        <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
                <?php if ( $wgVectorUseSimpleSearch && $this->getSkin()->getUser()->getOption( 'vector-simplesearch' ) ): ?>